package cn.kgc.client;

import cn.kgc.entity.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/4/20
 * @Description:
 */
@FeignClient("ORDERCLIENT")  // 标识服务的名称
public interface OrderClient {

     @RequestMapping("/order/m1")
     String method1();

    @RequestMapping("/order/m2")
    String method2();


    @RequestMapping("/order/m3")  // 根据用户名查询订单  ?  /order/m3?username=tom
    List<Order> method3(@RequestParam("username") String  username);

     @RequestMapping("/order/m4/{id}")  // 根据id查询订单  restful
     Order method4(@PathVariable("id") Integer id);


    @RequestMapping("/order/m5")  // 保存订单  http://localhost:8510/user/m5?id=20&username=tom&productName=phone
    String method5(@RequestParam("username") String username,@RequestParam("id") Integer id,@RequestParam("productName") String productName);

    @RequestMapping("/order/m6")  // 修改订单  json
    String method6(@RequestBody Order order);

}
